var itemList = Array(
    // 2048824, // 究极黑暗宠物装备魔力卷轴
    // 2048823, // 究极黑暗宠物装备攻击力卷轴
    2616215, // 究极黑暗防具魔力卷轴
    2616214, // 究极黑暗防具攻击力卷轴
    2615050, // 究极黑暗饰品魔力卷轴
    2615049, // 究极黑暗饰品攻击力卷轴
    2613067, // 究极黑暗单手武器魔力卷轴
    2613066, // 究极黑暗单手武器攻击力卷轴
    2612079, // 究极黑暗双手武器魔力卷轴
    2612078  // 究极黑暗双手武器攻击力卷轴
);

function enter(pi) {
    if (pi.getMap().getAllMonster().size() != 0) {
        pi.playerMessage("还有剩下的怪物。");
    } else {
        var eim = pi.getPlayer().getEventInstance();
        var player = pi.getPlayer();
        var stage = parseInt(eim.getProperty("stage"));
        var itemQ = 10 * Math.floor(stage/10) + 10;
        stage = stage + 1;
        if (stage == 63) {
            pi.warp(925020001, 0);
            var chance = Math.floor(Math.random() * 10);
            var itemId = itemList[chance];
            player.gainItem(itemId, 1, "武陵道场");
            player.dropSpouseMessage(0x1A, "恭喜玩家" + player.getName() + "通关武陵道场,获取究极黑暗卷" + 1 + "张");
        } else {
            eim.setProperty("stage", String(stage));
            var map = eim.getMapInstance(stage);
            player.changeMap(map, map.getPortal(0));
        }
        player.gainItem(4310066, 1, "武陵道场");
        player.gainItem(4001620, itemQ, "武陵道场");
        player.dropSpouseMessage(0x06, "获取其他物品（武公的证物）" + itemQ + "个以及冬季限量硬币 1 个");
    }
}
